import dayjs from "dayjs"
export default async (that)=>{
	return {
		columns:[
			{
				key:"name",
				label:"销售名称"
			},
			{
				key:"saleCount",
				label:"订单数量"
			},
			{
				key:"saleMoney",
				label:"订单金额"
			}
		],
		reqOptions:{
			list:{
				method:"get",
				url:"/sales/orderCount"       
			},
		},
		search:{
			form:{
				startTime:dayjs().startOf("month").format("YYYY-MM-DD"),
				endTime:dayjs().endOf("month").format("YYYY-MM-DD")
			},
			options:[
				{
					key:"startTime",
					label:"开始时间",
					type:"el-date-picker",
					props:{
						type:"date",
						format:"yyyy-MM-dd",
						"value-format":"yyyy-MM-dd",
						placeholder:"统计开始时间"
					},
					// required:true
				},
				{
					key:"endTime",
					label:"截止时间",
					type:"el-date-picker",
					props:{
						type:"date",
						format:"yyyy-MM-dd",
						"value-format":"yyyy-MM-dd",
						placeholder:"统计结束时间"

					},
					// required:true
				},
				{
					key:"test",
					type:"el-button",
					label:"查询",
					removeLabel:true,
					width:false,
					props:{
						type:"primary",
						// size:"medium"
					},
					listeners:{
						click(...e){
							that.searchFun && that.searchFun instanceof Function && that.searchFun(...e)
							that.$emit("search")
							console.log("click")
							that.getList()
						}
					}
				},
			],
			direction:"h",
			labelPosition:"right"
		},
		operation:{},
		updateField:async (form={})=>{
			return {
				form,
				direction:"h",
				options:[
					{
						key:"name",
						label:"销售名称",
						type:"el-input",
						required:true
					},
					// {
					// 	key:"isDefault",
					// 	label:"是否默认",
					// 	type:"el-switch",
					// 	props:{
					// 		activeValue:1,
					// 		inactiveValue:0
					// 	}
					// }
                    
				]
			}
		}
        
	}
}